package com.ruoyi.campus.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.campus.mapper.MyInformationMapper;
import com.ruoyi.campus.domain.MyInformation;
import com.ruoyi.campus.service.IMyInformationService;

/**
 * 华软资讯Service业务层处理
 *
 * @author zht
 * @date 2022-01-14
 */
@Service
public class MyInformationServiceImpl implements IMyInformationService
{
    @Autowired
    private MyInformationMapper myInformationMapper;

    /**
     * 查询华软资讯
     *
     * @param imtId 华软资讯主键
     * @return 华软资讯
     */
    @Override
    public MyInformation selectMyInformationByImtId(String imtId)
    {
        return myInformationMapper.selectMyInformationByImtId(imtId);
    }

    /**
     * 查询华软资讯列表
     *
     * @param myInformation 华软资讯
     * @return 华软资讯
     */
    @Override
    public List<MyInformation> selectMyInformationList(MyInformation myInformation)
    {
        return myInformationMapper.selectMyInformationList(myInformation);
    }

    /**
     * 新增华软资讯
     *
     * @param myInformation 华软资讯
     * @return 结果
     */
    @Override
    public int insertMyInformation(MyInformation myInformation)
    {
        myInformation.setCreateTime(DateUtils.getNowDate());
        return myInformationMapper.insertMyInformation(myInformation);
    }

    /**
     * 修改华软资讯
     *
     * @param myInformation 华软资讯
     * @return 结果
     */
    @Override
    public int updateMyInformation(MyInformation myInformation)
    {
        return myInformationMapper.updateMyInformation(myInformation);
    }

    /**
     * 批量删除华软资讯
     *
     * @param imtIds 需要删除的华软资讯主键
     * @return 结果
     */
    @Override
    public int deleteMyInformationByImtIds(String[] imtIds)
    {
        return myInformationMapper.deleteMyInformationByImtIds(imtIds);
    }

    /**
     * 删除华软资讯信息
     *
     * @param imtId 华软资讯主键
     * @return 结果
     */
    @Override
    public int deleteMyInformationByImtId(String imtId)
    {
        return myInformationMapper.deleteMyInformationByImtId(imtId);
    }

    /**
     * 根据imtId获取资讯详情信息
     * @param imtId 华软资讯主键
     * @return 结果
     */
    @Override
    public Map<String, Object> getDetailByImtId(String imtId) {
        return myInformationMapper.getDetailByImtId(imtId);
    }

    /**
     * 查询最新三条资讯
     * @return 结果
     */
    @Override
    public List<Map<String,Object>> selectTopThreeInformation() {
        return myInformationMapper.selectTopThreeInformation();
    }
}
